// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// 导入 axios 支持
import axios from 'axios'
// 导入 QS
import qs from 'qs'

// 设置全局 QS
Vue.prototype.qs = qs;

// 设置 axios 的变量
Vue.prototype.$axios = axios;
Vue.config.productionTip = false

// 设置 axios 全局请求头【中文 cn ， 英文 en 】

/**
 * 如果存在 lang 则判断当前语言，如果不存在就设置默认语言
 */
let config_language = localStorage.getItem("config_language");
if(config_language) {
	switch(config_language) {
		case 'cn':
			localStorage.setItem("config_language", "cn")
			config_language = "cn";
			break;
		case 'en':
			localStorage.setItem("config_language", "en")
			config_language = "en";
			break;
		default:
			localStorage.setItem("config_language", "cn")
			config_language = "cn";
	}
} else {
	localStorage.setItem("config_language", "cn")
	config_language = "cn";
}
axios.defaults.headers.common['Language'] = config_language;

/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	components: {
		App
	},
	template: '<App/>'
})